#!/bin/sh
#
SED=/usr/bin/sed
#
if [ $# -ne 0 ]; then
    echo "Usage: ExpandEnvVars.sh" 1>&2
    exit 1
fi
#
while read LINE; do
    ENVAR=`echo "$LINE" | $SED -n 's/.*\(${[A-Z][_A-Z]*}\).*/\1/p'`
    if [ -n "$ENVAR" ]; then
        eval VALUE="$ENVAR"
        echo "$LINE" | $SED 's/'"$ENVAR"'/'"$VALUE"'/'
    else
        echo "$LINE"
    fi
done
#
exit 0
